package com.itlong.cloud.sdk.resource;

import com.itlong.cloud.POJO.DTO.sdk.CloudDeviceSDKDTO;
import com.itlong.cloud.POJO.DTO.sdk.CloudFaceApiDTO;
import com.itlong.cloud.POJO.DTO.sdk.sendPush.SendPushMessageDTO;
import com.itlong.cloud.POJO.VO.sdk.SDKEquipRecordGetVO;
import com.itlong.cloud.POJO.VO.sdk.SDKProjectBuildInfoVO;
import com.itlong.cloud.POJO.VO.sdk.SDKProjectRoomInfoVO;
import com.itlong.cloud.POJO.VO.sdk.SDKProjectUnitInfoVO;
import com.itlong.cloud.project.sdk.ISDKServerProjectServiceClient;
import com.itlong.cloud.sdk.service.ISDKServerProjectService;
import com.itlong.cloud.utils.page.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * <desc>
 *      SDK项目服务层暴露接口实现类
 * </desc>
 *
 * @createDate 2019/11/7
 */
@RestController
public class SDKServerProjectServiceResource implements ISDKServerProjectServiceClient {

    @Autowired
    private ISDKServerProjectService iSDKServerProjectService;

    /**
     * <desc>
     *      获取项目的楼栋信息列表
     * </desc>
     *
     * @param dto 查询参数
     * @return 楼栋信息列表
     * @author Juguang.S
     * @createDate 2019/11/7
     */
    @Override
    @PostMapping(path = "/SDK/server/getBuildList")
    public Page<SDKProjectBuildInfoVO> getBuildList(@RequestBody CloudDeviceSDKDTO dto) throws Exception{
        return iSDKServerProjectService.getBuildList(dto);
    }

    /**
     * <desc>
     *      获取项目楼栋的单元信息列表
     * </desc>
     *
     * @param dto 查询参数
     * @return 楼栋信息列表
     * @author Juguang.S
     * @createDate 2019/11/7
     */
    @Override
    @PostMapping(path = "/SDK/server/getUnitList")
    public Page<SDKProjectUnitInfoVO> getUnitList(@RequestBody CloudDeviceSDKDTO dto) throws Exception {
        return iSDKServerProjectService.getUnitList(dto);
    }

    /**
     * <desc>
     *     获取项目房间信息列表
     * </desc>
     *
     * @param dto 查询参数
     * @return 楼栋信息列表
     * @author Juguang.S
     * @createDate 2019/11/8
     */
    @Override
    @PostMapping(path = "/SDK/server/getRoomList")
    public Page<SDKProjectRoomInfoVO> getRoomList(@RequestBody CloudDeviceSDKDTO dto) throws Exception {
        return iSDKServerProjectService.getRoomList(dto);
    }

    /**
     * <desc>
     *     获取项目的通行记录列表
     * </desc>
     *
     * @param dto 查询参数
     * @return 通行记录信息列表
     * @author Juguang.S
     * @createDate 2019/11/11
     */
    @Override
    @PostMapping(path = "/SDK/server/getPassRecordByPage")
    public Page<SDKEquipRecordGetVO> getPassRecordByPage(@RequestBody CloudDeviceSDKDTO dto) throws Exception {
        return iSDKServerProjectService.getPassRecordByPage(dto);
    }

    /**
     * <desc>
     *     删除时间段通行记录
     * </desc>
     *
     * @param dto 查询参数
     * @return 通行记录信息列表
     * @author Qiang.S
     * @createDate 2020/07/02
     */
    @Override
    @PostMapping(path = "/SDK/server/deleteRecordByDate")
    public Integer deleteRecordByDate(@RequestBody CloudDeviceSDKDTO dto) throws Exception {
        return iSDKServerProjectService.deleteRecordByDate(dto);
    }

    /**
     * <desc>
     * 查询第三方消息回调地址
     * </desc>
     *
     * @Author chengshican
     * @Date 2020-11-23 11:08
     * @Param
     * @Return
     * @Exception
     */
    @Override
    @GetMapping(path = "/SDK/server/getSendMessgeUrl")
    public Integer getSendMessgeUrl(@RequestParam("type") String type, @RequestParam("newVersion") double newVersion) throws Exception {
        return iSDKServerProjectService.getSendMessgeUrl(type,newVersion);
    }

    /**
     * <desc>
     * 修改第三方对接接口的版本号
     * </desc>
     *
     * @param dto
     * @Author chengshican
     * @Date 2020-11-23 11:09
     * @Param SendPushMessageDTO
     * @Return
     * @Exception
     */
    @Override
    @PostMapping(path = "/SDK/server/updateSDKApiVersion")
    public Integer updateSDKApiVersion(SendPushMessageDTO dto) throws Exception {
        return iSDKServerProjectService.updateSDKApiVersion(dto);
    }

}
